package com.zy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zy.entity.Notice;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface NoticeMapper extends BaseMapper<Notice> {
    @Select("SELECT * FROM `notice` order by time desc LIMIT 0,7")
    public List<Notice> getNoticeList();

    @Delete("delete from notice where id = #{id}")
    public void deleteNoticeById(Integer id);

    @Insert("insert into notice(time,content,date) values(#{time},#{content},#{date})")
    public void addNotice(Notice notice);

    @Select("select id,time,content,date from notice where id = #{id}")
    public Notice getNoticeById(Integer id);

    @Update("update notice set time = #{time},content=#{content},date=#{date} where id = #{id}")
    public void updateNotice(Notice notice);
}
